﻿using System;
using System.Globalization;
using System.Linq;
using System.Windows.Controls;
using System.Windows.Data;

namespace WIAssistant
{
    [ValueConversion(typeof(double), typeof(String))]
    public class DisableWorkItemConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                int workItemID = (int)values[1];

                if (MainMediator.Instance.WorkItemsIDsToDisable.Where(x => x == workItemID).Count() > 0)
                    return true;
                else
                    return false;
            }
            catch (InvalidCastException)
            {
                return true;
            }
            
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new Exception("The method or operation is not implemented.");
        }
    }

}
